/**
 * Created by yxk at 2020/6/1
 */
import request from '@/utils/request'

/**
 * 产品新建/编辑
 */
export function jxcProductAddOrUpdateAPI(data, isUpdate = false) {
  return request({
    url: 'jxcProduct/addOrUpdate' + (isUpdate ? '/update' : '/add'),
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * 删除产品
 */
export function jxcProductDeleteByIdsAPI(data) {
  return request({
    url: 'jxcProduct/deleteByIds',
    method: 'post',
    data: data
  })
}

/**
 * 产品上下架
 */
export function jxcProductUpdateShelfAPI(data) {
  return request({
    url: 'jxcProduct/addorUpdateShelf',
    method: 'post',
    data: data
  })
}

/**
 * 产品详情头部主要信息
 */
export function jxcProductQueryByIdAPI(data) {
  return request({
    url: `jxcProduct/queryById/${data.label}`,
    method: 'post',
    data: data
  })
}

/**
 * 查询产品类别
 */
export function jxcProductQueryProductTypeAPI(data) {
  return request({
    url: 'jxcProductType/queryJxcProductType',
    method: 'post',
    data: data
  })
}

/**
 * 编辑产品类别
 */
export function jxcProductAddOrUpdateProductTypeAPI(data) {
  return request({
    url: 'jxcProductType/addorUpJxcProductType',
    method: 'post',
    data: data
  })
}

/**
 * 删除产品类别
 */
export function jxcProductDeleteProductTypeByIdAPI(data) {
  return request({
    url: 'jxcProductType/deleteById',
    method: 'post',
    data: data
  })
}

/**
 * 查询产品规格
 */
export function jxcProductQueryProductSizeAPI(data) {
  return request({
    url: 'jxcProductSpecifications/querySpecificationsDate',
    method: 'post',
    data: data
  })
}

/**
 * 新增产品规格
 */
export function jxcProductAddProductSizeAPI(data) {
  return request({
    url: 'jxcProductSpecifications/addOrUpSpecificationsDate',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
